<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>代理商列表</h2>
    </div>
    <div class="cf">
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
        	<div class="sleft">
                <select name="pt_role" id="status">
                    <option value="-1" <if condition="$status eq -1">selected</if>  style="width:200px">平台角色选择</option>
                    <option value="1" <if condition="$status eq 1">selected</if>  style="width:200px">代理商</option>
                    <option value="2" <if condition="$status eq 2">selected</if>  style="width:200px">坐市商</option>
                </select>
            </div>
            <div class="sleft">
                <input type="text" name="nickname" class="search-input" value="{:I('nickname')}" placeholder="昵称查询">
            </div>
            <div class="sleft">
                <input type="text" name="user_name" class="search-input" value="{:I('user_name')}" placeholder="代理商账户查询">
            </div>
            <div class="sleft">
                <input type="text" id=create_time name="create_time" class="search-input" value="{:I('create_time')}" placeholder="创建时间">
            </div>
            <div class="sleft">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">ID</th>
                <th class="">昵称</th>
                <th class="">电话</th>
                <th class="">代理商账户</th>
                <th class="">坐市场比例</th>
                <th class="">保证金</th>
                <th class="">下级余额总和</th>
                <th class="">平台角色</th>
                <th class="">创建时间</th>
                <!--<th class="">类型</th>-->
                <th class="">保证金状态</th>
                <th class="">客户资金汇总</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="list">
                <volist name="list" id="vo">
                    <tr>
                        <td><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" /></td>
                        <td>{$vo.id}</td>
                        <td>{$vo.nickname}</td>
                        <td>{$vo.mobile}</td>
                        <td>{$vo.user_name}</td>
                        <td>{$vo.market}</td>
                        <td>{$vo.sure_money}  元</td>
                        <td>{$vo.route_money}  元</td>
                        <td>
                        <if condition = "$vo['pt_role'] eq 2">
                      		  坐市商
                        <elseif condition = "$vo['pt_role'] eq 1"/>
                        	代理商
                        </if>
                        </td>
                        <td>{$vo.create_time|time_format}</td>
                        <!--<td>{$vo.type}</td>-->
                        <td>{$vo.status}</td>
                        <if condition = "$vo['pt_role'] eq 2">
                            <td><a href="{:U('FuturesAgent/all_money',array('id'=>$vo['id'],'status'=>'-2'))}">查看</a></td>
                        <elseif condition = "$vo['pt_role'] eq 1"/>
                            <td><a href="{:U('FuturesAgent/agent_all_money',array('id'=>$vo['id'],'status'=>'-2'))}">查看</a></td>
                        </if>
                    </tr>
                </volist>
                <else/>
                <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script>
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js?v={:SITE_VERSION}"></script>
    <script type="text/javascript">
        $('#begin_time,#end_time,#create_time,#apply_time').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true,
        });
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            url = url.substr(0,url.lastIndexOf('.'));
            var query  = $('.search-form').find('input').serialize();
            var status=$('#status').val();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            query+="/pt_role/"+status;
            query = query.replace(/=/gm,"/");
            query = query.replace(/&/gm,"/");
            if( url.indexOf('?')>0 ){
            	if(query.substr(0,1) != "/"){
            		url += "/"+query;
            	}else{
            		url += query;
            	}
            }else{
                url += "/" + query;
            }
            //alert(url);
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        $('.side-sub-menu').find('a[href="{:U('FuturesAgent/index')}"]').closest('li').addClass('current');
    </script>
</block>
